package com.wondersgroup.esclient.service;

import java.io.Serializable;
import java.util.List;

import com.wondersgroup.esclient.modle.Pager;
import com.wondersgroup.esclient.modle.QueryParam;

/**
 * ES调用服务类
 * @author Walker
 *
 * @param <T>
 */
public interface ESClientService<T> {

	/**
	 * 创建Mappings
	 * @return
	 * @throws Exception
	 */
	public String creatMappings() throws Exception;

	/**
	 * 插入ES数据
	 * @param entity
	 * @return
	 * @throws Exception
	 */
	public String insert(T entity) throws Exception;
	
	/**
	 * 批量插入ES数据
	 * @param entitys
	 * @return
	 * @throws Exception
	 */
	public String insertBatch(List<T> entitys) throws Exception;

	/**
	 * 根据_id查询数据
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public T get(Serializable id) throws Exception;

	/**
	 * 根据条件查询
	 * @param queryParams
	 * @return
	 * @throws Exception
	 */
	public List<T> find(List<QueryParam> queryParams) throws Exception;
	
	/**
	 * 根据条件分页查询
	 * @param queryParams
	 * @param pager
	 * @return
	 * @throws Exception
	 */
	public Pager<T> findByPage(List<QueryParam> queryParams, Pager<T> pager) throws Exception;
	
}
